package com.lei.datastructure.collection.set;


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;

/**
 * @Author LeiXiaoLei
 * @Date 2022/8/17 16:53
 * @Version 1.0
 */
public class Main {
    private static double testSet(Set<String> set, String filename) {

        long startTime = System.nanoTime();

        System.out.println(filename);
        ArrayList<String> words = new ArrayList<>();
        if (FileOperation.readFile(filename, words)) {
            System.out.println("Total words: " + words.size());

            for (String word : words)
                set.add(word);
            System.out.println("Total different words: " + set.getSize());
        }
        long endTime = System.nanoTime();

        return (endTime - startTime) / 1000000000.0;
    }

    public static void main(String[] args) {
        int[][] arr = {{1, 2}, {1, 3}, {5, 1}, {3, 1}};
        Arrays.sort(arr, Comparator.comparingInt(a -> a[0]));
        System.out.println(Arrays.deepToString(arr));
//        String filename = "pride-and-prejudice.txt";
//
//        BSTSet<String> bstSet = new BSTSet<>();
//        double time1 = testSet(bstSet, filename);
//        System.out.println("BST Set: " + time1 + " s");
//
//        System.out.println();
//
//        LinkedListSet<String> linkedListSet = new LinkedListSet<>();
//        double time2 = testSet(linkedListSet, filename);
//        System.out.println("Linked List Set: " + time2 + " s");

    }
}
